#include <stdio.h>

/*
 * 对过程的间接调用
 */

int main()
{
	int a = 0;

	while (a++ < 10) {
		if (a == 2)
			continue;

		printf("%x\n", a);
	}

	do {
		if (a == 2)
			continue;

		printf("%x\n", a);
	}
	while (--a > 0);

	return 0;
}

#if 0

/*
 * intel
 */
0000000000001149 <main>:
    1149:	f3 0f 1e fa          	endbr64 
    114d:	55                   	push   %rbp
    114e:	48 89 e5             	mov    %rsp,%rbp
    1151:	48 83 ec 10          	sub    $0x10,%rsp
    1155:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%rbp)	// (rbp-0x4)=0x0

    115c:	eb 1e                	jmp    117c <main+0x33>	// jump
    115e:	83 7d fc 02          	cmpl   $0x2,-0x4(%rbp)	// (rbp-0x4)-0x2
    1162:	75 02                	jne    1166 <main+0x1d>	// 不等/非零
    1164:	eb 16                	jmp    117c <main+0x33>	// jump
    1166:	8b 45 fc             	mov    -0x4(%rbp),%eax	// eax=(rbp-0x4)
    1169:	89 c6                	mov    %eax,%esi	// esi=eax
    116b:	48 8d 3d 92 0e 00 00 	lea    0xe92(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    1172:	b8 00 00 00 00       	mov    $0x0,%eax
    1177:	e8 d4 fe ff ff       	callq  1050 <printf@plt>	// printf()
    117c:	8b 45 fc             	mov    -0x4(%rbp),%eax	// eax=(rbp-0x4)
    117f:	8d 50 01             	lea    0x1(%rax),%edx	// edx=(rax+0x1)
    1182:	89 55 fc             	mov    %edx,-0x4(%rbp)	// (rbp-0x4)=edx
    1185:	83 f8 09             	cmp    $0x9,%eax	// eax=0x9
    1188:	7e d4                	jle    115e <main+0x15>	// 小于等于(有符号<=)

    118a:	83 7d fc 02          	cmpl   $0x2,-0x4(%rbp)	// (rbp-0x4)-0x2
    118e:	74 18                	je     11a8 <main+0x5f>	// 等于/零
    1190:	8b 45 fc             	mov    -0x4(%rbp),%eax	// eax=(rbp-0x40
    1193:	89 c6                	mov    %eax,%esi	// esi=eax
    1195:	48 8d 3d 68 0e 00 00 	lea    0xe68(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    119c:	b8 00 00 00 00       	mov    $0x0,%eax
    11a1:	e8 aa fe ff ff       	callq  1050 <printf@plt>
    11a6:	eb 01                	jmp    11a9 <main+0x60>	// jump

    11a8:	90                   	nop
    11a9:	83 6d fc 01          	subl   $0x1,-0x4(%rbp)	// (rbp-0x4)-=0x1
    11ad:	83 7d fc 00          	cmpl   $0x0,-0x4(%rbp)	// (rbp-0x4)-0x0
    11b1:	7f d7                	jg     118a <main+0x41>	// 大于(有符号>)
    11b3:	b8 00 00 00 00       	mov    $0x0,%eax
    11b8:	c9                   	leaveq 
    11b9:	c3                   	retq   
    11ba:	66 0f 1f 44 00 00    	nopw   0x0(%rax,%rax,1)

/*
 * arm
 */
000000000040055c <main>:
  40055c:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
  400560:	910003fd 	mov	x29, sp
  400564:	b9001fbf 	str	wzr, [x29, #28]		// [x29+28]=0
  400568:	14000009 	b	40058c <main+0x30>
  40056c:	b9401fa0 	ldr	w0, [x29, #28]		// w0=[x29+28]
  400570:	7100081f 	cmp	w0, #0x2		// w0-0x2
  400574:	54000041 	b.ne	40057c <main+0x20>  // b.any	运算结果不等为0
  400578:	14000005 	b	40058c <main+0x30>
  40057c:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  400580:	911a6000 	add	x0, x0, #0x698
  400584:	b9401fa1 	ldr	w1, [x29, #28]
  400588:	97ffffb2 	bl	400450 <printf@plt>
  40058c:	b9401fa0 	ldr	w0, [x29, #28]
  400590:	11000401 	add	w1, w0, #0x1	// w1=w0+0x1
  400594:	b9001fa1 	str	w1, [x29, #28]	// [x29+28]=w1
  400598:	7100241f 	cmp	w0, #0x9
  40059c:	54fffe8d 	b.le	40056c <main+0x10>		带符号 <=

  4005a0:	b9401fa0 	ldr	w0, [x29, #28]
  4005a4:	7100081f 	cmp	w0, #0x2		// w0-0x2
  4005a8:	540000c0 	b.eq	4005c0 <main+0x64>  // b.none
  4005ac:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005b0:	911a6000 	add	x0, x0, #0x698
  4005b4:	b9401fa1 	ldr	w1, [x29, #28]
  4005b8:	97ffffa6 	bl	400450 <printf@plt>
  4005bc:	14000002 	b	4005c4 <main+0x68>

  4005c0:	d503201f 	nop
  4005c4:	b9401fa0 	ldr	w0, [x29, #28]
  4005c8:	51000400 	sub	w0, w0, #0x1
  4005cc:	b9001fa0 	str	w0, [x29, #28]
  4005d0:	b9401fa0 	ldr	w0, [x29, #28]
  4005d4:	7100001f 	cmp	w0, #0x0
  4005d8:	54fffe4c 	b.gt	4005a0 <main+0x44>
  4005dc:	52800000 	mov	w0, #0x0                   	// #0
  4005e0:	a8c27bfd 	ldp	x29, x30, [sp], #32
  4005e4:	d65f03c0 	ret

#endif
